import React from 'react';
import Base from './base';
import ModalDialogList from './modalDialogList';

const init = (property, pageAxis) => {
    property.isInit = true;
    const { pageConfig } = pageAxis;
    if (property.properties) {
        pageConfig.dialogViews = pageConfig.dialogViews || [];
        pageConfig.dialogViews = pageConfig.dialogViews.concat(property.properties);
    }
};

export default (props) => {
    const { property, pageAxis } = Base.getProps(props);

    if (!property.isInit) {
        init(property, pageAxis);
    }

    return <ModalDialogList property={pageAxis.modalDialog} />;
};